package com.lou.springboot.controller;

import com.lou.springboot.entity.SaleGoods;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class TestController {
    @GetMapping("/get/httpmessageconverter")
    @ResponseBody
    public SaleGoods httpMessageConverterTest(){
        SaleGoods saleGoods = new SaleGoods();
        saleGoods.setGoodsName("华为手机");
        saleGoods.setId(1);
        saleGoods.setWeight(190);
        saleGoods.setOnSale(true);
        saleGoods.setType(1);
        return saleGoods;
    }
    @PostMapping("/post/httpmessageconverter")
    @ResponseBody
    public SaleGoods httpMessageConverterTest2(@RequestBody SaleGoods saleGoods){
        return saleGoods;
    }
}
